#ifndef _BSP_RTC_H
#define _BSP_RTC_H
#include "imx6ull.h"

/* 时间有关结构体 */
struct rtc_datetime{
    unsigned short year;
    unsigned char month;
    unsigned char day;
    unsigned char hour;
    unsigned char minute;
    unsigned char second;

};


void rtc_disable(void);
void rtc_enable(void);
void rtc_init(void);
unsigned int rtc_coverdate_to_seconds(struct rtc_datetime *datetime);
void rtc_convertseconds_to_datetime(unsigned int seconds, struct rtc_datetime *datetime);
unsigned char rtc_isleapyear(unsigned short year);
void rtc_setdatetime(struct rtc_datetime *datetime);
unsigned int rtc_getseconds(void);
void rtc_getdatetime(struct rtc_datetime *datetime);




/* 时间有关的宏定义 */
#define SECONDS_IN_DAY      (24*60*60)
#define SECONDS_IN_HOUR     (60*60)
#define SECONDS_IN_MINUTE   (60)
#define DAYS_IN_YEAR        (365)
#define YEAR_RANGE_START    (1970)
#define YEAR_RANGE_END      (2099)


#endif
